home *** CD-ROM | disk | FTP | other *** search
- class EditorPanMachine extends Library.State
- {
- var oCenterMachine;
- var mcRef;
- static var DEPTH_VISUAL = 150;
- static var DEPTH_NUMBER = 450;
- static var RECURSIVE_LEVEL_SEARCH = 5;
- static var SCALE_PERCENT = 30;
- static var VISUAL_IN_BOX_X = -225;
- static var VISUAL_IN_BOX_Y = -60;
- function EditorPanMachine(__mcRef)
- {
- super(__mcRef);
- this.oCenterMachine = new EditorCenterPanMachine(this.mcRef.mcState.mcCenter,this);
- this.oCenterMachine.setNumber(1);
- this.oCenterMachine.setRef(this.mcRef.mcState.mcCenter);
- Main.Instance.doAddListener(this);
- this.setState("Idle");
- }
- function doScrollToLeft()
- {
- this.setState("ToLeft");
- }
- function doScrollToRight()
- {
- this.setState("ToRight");
- }
- function setVisualForBox(__sLinkage, __mcBox)
- {
- __mcBox.mcNumber.swapDepths(EditorPanMachine.DEPTH_NUMBER);
- __mcBox.mcData.mcVisual.removeMovieClip();
- __mcBox.mcData.attachMovie(__sLinkage,"mcVisual",EditorPanMachine.DEPTH_VISUAL);
- __mcBox.mcData.mcVisual.gotoAndStop(__mcBox.mcData.mcVisual._totalframes);
- __mcBox.mcData.mcVisual._xscale = EditorPanMachine.SCALE_PERCENT;
- __mcBox.mcData.mcVisual._yscale = EditorPanMachine.SCALE_PERCENT;
- __mcBox.mcData.mcVisual._x = EditorPanMachine.VISUAL_IN_BOX_X;
- __mcBox.mcData.mcVisual._y = EditorPanMachine.VISUAL_IN_BOX_Y;
- this.doRecursiveWorkOn(__mcBox.mcData.mcVisual,EditorPanMachine.RECURSIVE_LEVEL_SEARCH);
- }
- function doRecursiveWorkOn(__mc, __nRecursive)
- {
- if(__mc instanceof MovieClip)
- {
- __mc.stop();
- if(__mc._name.indexOf("Hit") != -1)
- {
- __mc._visible = false;
- }
- else if(__mc._name.indexOf("Ground") != -1)
- {
- __mc._visible = false;
- }
- }
- if(__nRecursive > 0)
- {
- for(var _loc4_ in __mc)
- {
- this.doRecursiveWorkOn(__mc[_loc4_],__nRecursive);
- }
- __nRecursive = __nRecursive - 1;
- }
- }
- function doRefreshVisual()
- {
- this.oCenterMachine.doRefreshVisual();
- this.doLoadStateAction();
- }
- function doDestroy()
- {
- Main.Instance.doRemoveListener(this);
- }
- function get CenterMachine()
- {
- return this.oCenterMachine;
- }
- function doToLeft()
- {
- if(this.isStateComplete())
- {
- this.setState("Idle");
- }
- }
- function doToRight()
- {
- if(this.isStateComplete())
- {
- this.setState("Idle");
- }
- }
- function doLoadStateAction()
- {
- super.doLoadStateAction();
- this.oCenterMachine.setRef(this.mcRef.mcState.mcCenter);
- switch(this.CurrentState)
- {
- case "ToLeft":
- this.doSetUpLeft();
- break;
- case "ToRight":
- this.doSetUpRight();
- break;
- case "Idle":
- this.doSetUpIdle();
- LevelEditor.Instance.onMoveStop();
- }
- }
- function doSetUpLeft()
- {
- var _loc3_ = LevelEditor.Instance.CurrentPanelNumber;
- var _loc9_ = _loc3_ - 1;
- if(_loc9_ <= 0)
- {
- _loc9_ = LevelEditor.PANELS_QTY;
- }
- var _loc10_ = LevelEditor.Instance.getLinkageFor(_loc3_);
- var _loc13_ = LevelEditor.Instance.getLinkageFor(_loc9_);
- var _loc4_ = LevelEditor.Instance.getNumberForPanel(_loc10_);
- var _loc8_ = LevelEditor.Instance.getNumberForPanel(_loc13_);
- if(_loc4_ > LevelEditor.LETTERS.length - 1)
- {
- _loc4_ = 0;
- }
- else if(_loc4_ < 0)
- {
- _loc4_ = LevelEditor.LETTERS.length - 1;
- }
- if(_loc8_ > LevelEditor.LETTERS.length - 1)
- {
- _loc8_ = 0;
- }
- else if(_loc8_ < 0)
- {
- _loc8_ = LevelEditor.LETTERS.length - 1;
- }
- var _loc11_ = LevelEditor.LETTERS[_loc4_];
- var _loc12_ = LevelEditor.LETTERS[_loc8_];
- this.mcRef.mcState.mcBoxRight.mcNumber.txtNumber.text = _loc11_;
- var _loc6_ = LevelEditor.Instance.getLinkageFor(_loc3_);
- this.setVisualForBox(_loc6_,this.mcRef.mcState.mcBoxRight);
- var _loc7_ = _loc3_ - 2;
- if(_loc7_ > LevelEditor.PANELS_QTY)
- {
- _loc7_ = 1;
- }
- else if(_loc7_ < 0)
- {
- _loc7_ = LevelEditor.PANELS_QTY;
- }
- this.mcRef.mcState.mcBoxLeft._visible = true;
- this.mcRef.mcState.mcBoxLeft.mcNumber.txtNumber.text = _loc12_;
- _loc6_ = LevelEditor.Instance.getLinkageFor(_loc7_);
- this.setVisualForBox(_loc6_,this.mcRef.mcState.mcBoxLeft);
- var _loc5_ = _loc3_ - 1;
- if(_loc5_ > LevelEditor.PANELS_QTY)
- {
- _loc5_ = 1;
- }
- else if(_loc5_ <= 0)
- {
- _loc5_ = LevelEditor.PANELS_QTY;
- }
- this.oCenterMachine.setNumber(_loc5_);
- var _loc2_ = _loc3_ + 1;
- if(_loc2_ > LevelEditor.PANELS_QTY)
- {
- _loc2_ = 1;
- }
- else if(_loc2_ < 0)
- {
- _loc2_ = LevelEditor.PANELS_QTY;
- }
- this.mcRef.mcState.mcBoxRightAbs._visible = true;
- this.mcRef.mcState.mcBoxRightAbs.mcNumber.txtNumber.text = Library.Utils.Tools.getFormatedNumber(_loc2_,2);
- _loc6_ = LevelEditor.Instance.getLinkageFor(_loc2_);
- this.setVisualForBox(_loc6_,this.mcRef.mcState.mcBoxRightAbs);
- }
- function doSetUpRight()
- {
- var _loc2_ = LevelEditor.Instance.CurrentPanelNumber;
- var _loc9_ = LevelEditor.Instance.getLinkageFor(_loc2_ + 1);
- var _loc12_ = LevelEditor.Instance.getLinkageFor(_loc2_);
- var _loc4_ = LevelEditor.Instance.getNumberForPanel(_loc9_);
- var _loc7_ = LevelEditor.Instance.getNumberForPanel(_loc12_);
- if(_loc4_ > LevelEditor.LETTERS.length - 1)
- {
- _loc4_ = 0;
- }
- else if(_loc4_ < 0)
- {
- _loc4_ = LevelEditor.LETTERS.length - 1;
- }
- if(_loc7_ > LevelEditor.LETTERS.length - 1)
- {
- _loc7_ = 0;
- }
- else if(_loc7_ < 0)
- {
- _loc7_ = LevelEditor.LETTERS.length - 1;
- }
- var _loc10_ = LevelEditor.LETTERS[_loc4_];
- var _loc11_ = LevelEditor.LETTERS[_loc7_];
- this.mcRef.mcState.mcBoxLeft.mcNumber.txtNumber.text = _loc11_;
- var _loc6_ = LevelEditor.Instance.getLinkageFor(_loc2_);
- this.setVisualForBox(_loc6_,this.mcRef.mcState.mcBoxLeft);
- var _loc8_ = _loc2_ + 2;
- if(_loc8_ > LevelEditor.PANELS_QTY)
- {
- _loc8_ = 1;
- }
- else if(_loc8_ < 0)
- {
- _loc8_ = LevelEditor.PANELS_QTY;
- }
- this.mcRef.mcState.mcBoxRight._visible = true;
- this.mcRef.mcState.mcBoxRight.mcNumber.txtNumber.text = _loc10_;
- _loc6_ = LevelEditor.Instance.getLinkageFor(_loc8_);
- this.setVisualForBox(_loc6_,this.mcRef.mcState.mcBoxRight);
- var _loc5_ = _loc2_ + 1;
- if(_loc5_ > LevelEditor.PANELS_QTY)
- {
- _loc5_ = 1;
- }
- else if(_loc5_ < 0)
- {
- _loc5_ = LevelEditor.PANELS_QTY;
- }
- this.oCenterMachine.setNumber(_loc5_);
- var _loc3_ = _loc2_ - 1;
- if(_loc3_ > LevelEditor.PANELS_QTY)
- {
- _loc3_ = 1;
- }
- else if(_loc3_ < 0)
- {
- _loc3_ = LevelEditor.PANELS_QTY;
- }
- this.mcRef.mcState.mcBoxLeftAbs._visible = true;
- this.mcRef.mcState.mcBoxLeftAbs.mcNumber.txtNumber.text = Library.Utils.Tools.getFormatedNumber(_loc3_,2);
- _loc6_ = LevelEditor.Instance.getLinkageFor(_loc3_);
- this.setVisualForBox(_loc6_,this.mcRef.mcState.mcBoxLeftAbs);
- }
- function doSetUpIdle()
- {
- var _loc2_ = LevelEditor.Instance.CurrentPanelNumber;
- if(_loc2_ > 1)
- {
- this.mcRef.mcState.mcBoxLeft._visible = true;
- this.mcRef.mcState.mcBoxLeft.mcNumber.txtNumber.text = Library.Utils.Tools.getFormatedNumber(_loc2_ - 1,2);
- var _loc4_ = LevelEditor.Instance.getLinkageFor(_loc2_ - 1);
- this.setVisualForBox(_loc4_,this.mcRef.mcState.mcBoxLeft);
- }
- else
- {
- this.mcRef.mcState.mcBoxLeft._visible = false;
- }
- var _loc3_ = _loc2_;
- if(_loc3_ > LevelEditor.PANELS_QTY)
- {
- _loc3_ = 1;
- }
- else if(_loc3_ < 0)
- {
- _loc3_ = LevelEditor.PANELS_QTY;
- }
- this.oCenterMachine.setNumber(_loc3_);
- if(_loc2_ > LevelEditor.PANELS_QTY)
- {
- _loc2_ = 1;
- }
- else if(_loc2_ < 0)
- {
- _loc2_ = LevelEditor.PANELS_QTY;
- }
- this.mcRef.mcState.mcBoxRight._visible = true;
- this.mcRef.mcState.mcBoxRight.mcNumber.txtNumber.text = Library.Utils.Tools.getFormatedNumber(_loc2_ + 1,2);
- _loc4_ = LevelEditor.Instance.getLinkageFor(_loc2_ + 1);
- this.setVisualForBox(_loc4_,this.mcRef.mcState.mcBoxRight);
- }
- }
-